/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *
 *
 * Created by hattori <hattori@banana-systems.com>
 *                    <hattori@apache.org> (English Only)
 *
 *
 */

#ifndef MOD_OPENSOCIAL_SIGNED_AUTH_H 
#define MOD_OPENSOCIAL_SIGNED_AUTH_H      1 

#include "httpd.h"
#include "apr_hash.h"

#include "oauth.h"

module AP_MODULE_DECLARE_DATA auth_opensocial_module;

typedef struct
{
    int enabled;

    /* signature methods to accept */
    int hmac_sha1;
    int rsa_sha1;

    char *consumer_key;
    char *consumer_secret;
    char *token_secret;

    /* rsa public key file name */
    char *rsa_publickey_filename;
    /* contents of rsa_publickey_file  */
    char *rsa_publickey;

    /* required keys */
    apr_array_header_t *required_keys;

    /* required sets of key and value */
    apr_hash_t *required_kav;

    int debug_log_enabled;
    apr_port_t force_port;

} auth_opensocial_config_rec;

typedef struct
{
    int num_query_params;
    apr_hash_t *query_params;

    char *url;
    apr_port_t port;

    /* required oauth parameters ----- */

    char *oauth_consumer_key;
    char *oauth_token;

    // oauth_signature_method accepts either HMAC-SHA1 or RSA-SHA1.
    // OpenSocial uses OAuth's method for signing requests 
    // and containers may use the HMAC-SHA1 or RSA-SHA1 algorithms. 
    // http://code.google.com/intl/en/apis/opensocial/articles/appengine-0.8.html 
    char *oauth_signature_method;

    char *oauth_timestamp;
    char *oauth_nonce;
    char *oauth_version;
    char *oauth_signature;

    /* signature base string ----- */
    char *sbs;

} signed_request_rec;


#endif


